package com.cac.demo.controller.logMonitor;

import com.cac.demo.dao.logMonitor.SynthesizeQueryDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("synthesizeQueryRest")
public class SynthesizeQueryRest {
    @Autowired
    private SynthesizeQueryDao synthesizeQueryDao;
    @PostMapping("queryGkLog")
    public PageInfo queryGkLog(@RequestBody Map map){
        Map<String, Integer> page = (Map) map.get("page");
        PageHelper.startPage(page.get("currentPage"),page.get("pageSize"));
        List data = synthesizeQueryDao.queryGkLog((Map) map.get("queryParam"));
        PageInfo pageInfo = new PageInfo(data);
        return pageInfo;
    }

    @PostMapping("queryWorkbinReceParent")
    public PageInfo queryWorkbinReceParent(@RequestBody Map map){
        Map<String, Integer> page = (Map) map.get("page");
        PageHelper.startPage(page.get("currentPage"),page.get("pageSize"));
        List<HashMap> data = synthesizeQueryDao.quereyWorkbinReceParent((Map) map.get("queryParam"));
        PageInfo pageInfo = new PageInfo(data);
        return pageInfo;
    }

    @PostMapping("queryWorkbinReceChild")
    public List queryWorkbinReceChild(@RequestBody Map map){
        List data = synthesizeQueryDao.quereyWorkbinReceChild((Map) map.get("queryParam"),(Map) map.get("tree"));
        return data;
    }

    @PostMapping("queryWorkbinParent")
    public PageInfo queryWorkbinParent(@RequestBody Map map){
        Map<String, Integer> page = (Map) map.get("page");
        PageHelper.startPage(page.get("currentPage"),page.get("pageSize"));
        List<HashMap> data = synthesizeQueryDao.queryWorkbinParent((Map) map.get("queryParam"));
        PageInfo pageInfo = new PageInfo(data);
        return pageInfo;
    }

    @PostMapping("queryWorkbinChild")
    public List queryWorkbinChild(@RequestBody Map map){
        List data = synthesizeQueryDao.queryWorkbinChild((Map) map.get("queryParam"),(Map) map.get("tree"));
        return data;
    }

}
